package com.tdkj.model.information;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanUser;

/**
 * XnkyPolicyInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "xnky_base_info")
public class BeanBaseInfo extends BaseEntity implements java.io.Serializable {

	// Fields

	private String title;
	private String moduletype;
	private String modulename;
	private String columntype;
	private String columnname;
	private String varietyid;//使用该属性来和tree进行关联
	private String variety;//使用该属性来和tree进行关联
	private Integer clicktime;
	private BeanUser user;
	private BeanExpert expert;
	private Timestamp createtime;
	private String resource;
	private String content;
	private String status;
	private String floatColor;
	private Map<String,String> prop;
	private List<BeanInfoComment> infoComments = new ArrayList<BeanInfoComment>(0);
	

	// Constructors

	/** default constructor */
	public BeanBaseInfo() {
	}
	@Column(name = "floatColor", length = 40)
	public String getFloatColor() {
		return floatColor;
	}

	public void setFloatColor(String floatColor) {
		this.floatColor = floatColor;
	}

	@Column(name = "title", length = 40)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	@Column(name = "columntype", length = 40)
	public String getColumntype() {
		return columntype;
	}

	public void setColumntype(String columntype) {
		this.columntype = columntype;
	}

	@Column(name = "columnname", length = 40)
	public String getColumnname() {
		return columnname;
	}

	public void setColumnname(String columnname) {
		this.columnname = columnname;
	}

	@Column(name = "moduletype", length = 40)
	public String getModuletype() {
		return moduletype;
	}

	public void setModuletype(String moduletype) {
		this.moduletype = moduletype;
	}

	@Column(name = "modulename", length = 40)
	public String getModulename() {
		return modulename;
	}

	public void setModulename(String modulename) {
		this.modulename = modulename;
	}
	@Column(name = "varietyid", length = 40)
	public String getVarietyid() {
		return varietyid;
	}

	public void setVarietyid(String varietyid) {
		this.varietyid = varietyid;
	}
	@Column(name = "variety", length = 40)
	public String getVariety() {
		return variety;
	}

	public void setVariety(String variety) {
		this.variety = variety;
	}

	@Column(name = "clicktime", length = 40)
	public Integer getClicktime() {
		return clicktime;
	}

	public void setClicktime(Integer clicktime) {
		this.clicktime = clicktime;
	}

	@Column(name = "createtime", length = 40)
	public Timestamp getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Timestamp createtime) {
		this.createtime = createtime;
	}
	@Column(name = "resource", length = 40)
	public String getResource() {
		return this.resource;
	}

	public void setResource(String resource) {
		this.resource = resource;
	}

	@Column(name = "content", length = 1000)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	@Column(name = "status", length = 1000)
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 * @return the properties
	 */
	@ElementCollection
	@CollectionTable(name="information_baseinfo_properties",
			joinColumns={@JoinColumn(name="baseinfo_id",referencedColumnName="id")})
	@MapKeyColumn(name="_key")
	@Column(name="_value")
	public Map<String, String> getProp() {
		return prop;
	}

	/**
	 * @param properties the properties to set
	 */
	public void setProp(Map<String, String> prop) {
		this.prop = prop;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "baseinfo")
	@OrderBy(value="createtime")
	public List<BeanInfoComment> getInfoComments() {
		return infoComments;
	}

	public void setInfoComments(List<BeanInfoComment> infoComments) {
		this.infoComments = infoComments;
	}


	@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.REFRESH)
	@JoinColumn(name = "userid")
	public BeanUser getUser() {
		return user;
	}

	public void setUser(BeanUser user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.REFRESH)
	@JoinColumn(name = "expertid")
	public BeanExpert getExpert() {
		return expert;
	}

	public void setExpert(BeanExpert expert) {
		this.expert = expert;
	}
	
}